<?php $this->start('menu') ?>
	<?php echo $this->element('menu', array("str_menu" => $str_menu)); ?>
<?php $this->end() ?>


<div id="right-panel">
	<?php if(isset($product)){  ?>
	<h1 class="post-title"><?php echo $product['Product']['name'] ?></h1>
	<ul class="info-detail">
		<li>
			<a href="#comments" class="comment-info"><?php echo count($comments) ?> Bình luận</a>
		</li>
		<li>
			<a href="http://www.facebook.com/sharer.php?u=<?php echo Router::url($this->here, true); ?>&t=<?php echo $product['Product']['name'] ?>" 
					target="_blank" class="facebook-info">Chia sẽ facebook</a>
		</li>
		<li>
			<a href="https://plus.google.com/share?url=<?php echo Router::url($this->here, true); ?>" target="_blank" class="google-info">Chia sẽ Google+</a>
		</li>
		<li>
			<a class="twitter-info" target="_blank"  href="http://twitter.com/share?text=<?php echo $product['Product']['name'] ?>&url=<?php echo Router::url($this->here, true); ?>">Chia sẽ Twitter</a>
		</li>
	</ul>
	<p style="text-align:justify;"><?php echo $product['Product']['short_desc'] ?></p>
	<div class="img-property">
		<?php $master = $this->Variants->getMasterVariant($product['Product']['id']) ?>
		<table class="tb-property">
			<?php foreach($product['ProductProperty'] as $i => $pp){ ?>
			<tr class="<?php echo $i%2==0 ? 'one' : '' ?>">
				<td>
					<?php $property = $this->Properties->getProperty($pp['property_id']) ?>
					<?php echo $property['Property']['name'] ?>
				</td>
				<td><?php echo $pp['value'] ?></td>
			</tr>
			<?php } ?>
			<tr>
				<td colspan=2><div class="price-dt">Giá: <span><?php echo $master['Variant']['price'] ?></span> VND</div></td>
			</tr>
			<tr>
				<td colspan=2>
				<?php echo $this->Form->create('Cart', array('url' => '/addToCart/'.$product['Product']['id'], 'id' => 'addToCart', 'class' => 'addToCart'));?>
					<input type="submit" value="Chọn mua" class="addToCart btn-style" /> &nbsp;&nbsp;
					<select id="cart_quantity" class="pr-quantity" name="data[Cart][quantity]">
						<option value='1'>1</option>
						<option value='2'>2</option>
						<option value='3'>3</option>
						<option value='4'>4</option>
						<option value='5'>5</option>
					</select> Sản phẩm
				<?php echo $this->Form->end() ?>
				</td>
			</tr>
		</table>
		<div class='proimg-detail'> 
			<?php echo $this->Images->showMedium($master['Image'][0]); ?>
		</div>
	</div>
	<div class="product_desc"><?php echo $product['Product']['description'] ?></div>
	
	<div id="comments">
		<h3>Các lời bình luận (<?php echo count($comments) ?>)</h3>
		<?php echo $this->element('Comments/comments', array('comments' => $comments)); ?>
		<h3>Viết bình luận</h3>
		<div class="comment-form">
		<?php $url = $this->Products->getSEOLink($product); ?>
    <?php echo $this->Form->create('Comment', array('url' => $url)); ?>
			<?php	echo $this->Session->flash('bad'); ?>
			<?php echo $this->Form->hidden('owner_id', array('value' => $product['Product']['id'] )) ?>
			<?php echo $this->Form->input('name', array('label' => __('Tên *'), 'class' => 'required')) ?>
			<?php echo $this->Form->input('email', array('label' => __('Email *'), 'class' => 'required email',))?>
			<?php echo $this->Form->input('content', array('type' => 'textarea', 'label' => __('Nội dung *'), 'class' => 'required')) ?>
      <div><?php echo __('Mã xác nhận *') ?></div> 
      <?php echo $this->Captcha->show($captcha_image_url, isset($success_captcha) ? $success_captcha : '' , isset($error_captcha) ? $error_captcha : '' ); ?>
			<?php echo $this->Form->hidden('callback', array('value' => $url)); ?>
		<?php echo $this->Form->end(array('label' => __('Gửi Bình Luận'), 'id' => 'submit_contact', 'style' => 'padding: 5px 10px; margin-top: 10px;', 'class' => 'submit')); ?>
		</div>
	</div>
	<?php  } ?>
</div> <!-- end #right-panel -->
<div id="left-panel">
	<?php echo $this->element('Frontend/posts_feature_vertical'); ?>
</div> <!-- end #left-panel -->	

<?php $this->start('script') ?>
	<?php echo $this->Html->script('jquery.validate.min'); ?>
	<?php echo $this->Html->script('messages_vi'); ?>
	<script type="text/javascript">
		jQuery(document).ready(function(){
			jQuery('#CommentDisplayForm').validate();
		});
	</script>
<?php $this->end() ?>
